/**
 * File Comment: Interface for sessions.
 */
package edu.gatech.oad.project.networking;

import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.net.Socket;

import edu.gatech.oad.project.operations.users.User;

/**
 * The session class represents the connection
 * once a user logs into the system.
 * 
 * @author James Moore
 * @version 1.0
 */
public abstract class Session implements Runnable {

    /**
     * Field user: Access to the user object
     */
    protected final User user;
    
    /**
     * Field id: access to the id of the user
     */
    protected final int id;
    
    /**
     * Field token: security token
     */
    protected final long token;
    
    /**
     * Field client: client socket
     */
    protected final Socket client;
    
    /**
     * Field outBound: stream to the client
     */
    protected final ObjectOutputStream outBound;
    
    /**
     * Field inBound: stream from the user
     */
    protected final ObjectInputStream inBound;
    
    /**
     * Creates a session with access to the user class
     * and its id.
     * 
     * @param user the user who logged in
     * @param token the security token to compare
     * @param client the client connection
     * @param outBound stream to the client
     * @param inBound stream from the client
     */
    public Session(User user, long token, Socket client, 
            ObjectOutputStream outBound, ObjectInputStream inBound) {
        this.user = user;
        if (user != null){
            id = user.getID(); 
        }
        else {
            id = -1;
        }
        
        this.token = token;
        this.client = client;
        this.outBound = outBound;
        this.inBound = inBound;
    }
    

/**    
    //APP SCHEDULER - PATIENT
    public abstract void loadDoctors();
    public abstract String getDoctors();
    public abstract void makeAppointment(int date, 
    int time, String docName, String reason);
    
    //CANCEL APP - PATIENT
    public abstract List<Appointment> getAppointmentsByDate(int date);
    public abstract void deleteAppointment(Appointment app);
    
    //APPOINTMENT SCREEN - Nurse, Doctor, Sys Admin
    public abstract List<Appointment> getDailyAppointments();
    public abstract List<Appointment> getAppointmentsByDoctor(String docName);
    
    public abstract void loadPatientsByName(String name);
    public abstract PatientInformation getPatient(String name);
    public abstract void updatePatientInfo(String patName, PatientInformation info);
    public abstract List<Appointment> getAppointmentsByPatient(String patientName);
    
    public abstract void updateAppointment(Appointment app, 
    TreatmentRecord record, DoctorOrders orders);
    public abstract void updateUser(String userName, int 
    newType, int status, String password); //sys admin
    // type: 0 patient, 1 nurse, 2 doctor, 3 admin
    // status: 0 active, 1 suspended
    
    public abstract void deleteAccount(String userName, int userType);
    
    public abstract boolean usernameAvailable(String username);
    public abstract void createPendingUser(String username, 
    String password, int userType);
    public abstract List<String> getPendingAccounts(); //list of strings as username, rank
    public abstract void confirmUser(String userName);
*/    
}